package com.shishuo.cms.action.blog;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.shishuo.cms.entity.vo.ArticleVo;
import com.shishuo.cms.exception.ArticleNotFoundException;
import com.shishuo.cms.service.ArticleService;

@Controller("bolgWenZhangAction")
@RequestMapping(value = "blog/article")
public class ArticleAction {

	@Autowired
	private ArticleService articleService;

	/**
	 * 首页
	 * 
	 * @param pageNum
	 * @param modelMap
	 * @return
	 * @throws ArticleNotFoundException
	 */
	@RequestMapping(value = "/view.htm", method = RequestMethod.GET)
	// 访问地址
	public String view(long articleId, ModelMap model)
			throws ArticleNotFoundException {
		ArticleVo vo = articleService.getArticleById(articleId);
		model.addAttribute("article", vo);
		return "blog/article";// 视图地址
	}
}
